<template>
  <div>
  <el-form :model="form" label-width="auto" style="max-width: 600px">
      <el-form-item label="用户名">
        <el-input v-model="form.username" />
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="form.password" />
      </el-form-item>
  </el-form>
  <el-form-item>
      <el-button type="primary" @click="onSubmit">登录</el-button>
      <el-button>取消</el-button>
  </el-form-item>
  </div>

</template>


<script setup>
import { ref,onMounted } from "vue"
import axios from "axios"



let form=ref({
  username:"",
  password:"",
})

const onSubmit=()=>{
  axios.post("http://127.0.0.1:8000/user/users/qwe/",{username:form.value.username,password:form.value.password})
  .then(res=>{
  console.log(res)
  if(res.status==201){
    ElMessage.success('添加成功')
 } })
}

onMounted(() => {})

</script>

<style scoped>

</style>
